<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <title>Happy ERP</title>
    <%= stylesheet_link_tag "/javascripts/ext/resources/css/ext-all.css" %>
    <%= stylesheet_link_tag "/stylesheets/tasks.css" %>
    <%= stylesheet_link_tag "/stylesheets/images.css" %>
    <%= stylesheet_link_tag "/javascripts/ext/examples/ux/css/ColumnNodeUI.css" %>


    <%= javascript_include_tag "ext/adapter/ext/ext-base.js" %>
    <%= javascript_include_tag "ext/ext-all.js" %>
    <%= javascript_include_tag "ext/src/locale/ext-lang-zh_CN.js" %>
    <%= javascript_include_tag "ext/examples/ux/ColumnNodeUI.js" %>
    <%= javascript_include_tag "system/actions.js" %>

    <script type="text/javascript">
      Ext.QuickTips.init();
      Ext.lib.Ajax.defaultPostHeader += ";charset=UTF-8";
      Ext.apply(Ext.form.VTypes, {
        daterange : function(val, field) {
          var date = field.parseDate(val);

          if(!date){
            return;
          }
          if (field.startDateField && (!this.dateRangeMax || (date.getTime() != this.dateRangeMax.getTime()))) {
            var start = Ext.getCmp(field.startDateField);
            start.setMaxValue(date);
            start.validate();
            this.dateRangeMax = date;
          }
          else if (field.endDateField && (!this.dateRangeMin || (date.getTime() != this.dateRangeMin.getTime()))) {
            var end = Ext.getCmp(field.endDateField);
            end.setMinValue(date);
            end.validate();
            this.dateRangeMin = date;
          }
          /*
           * Always return true since we're only using this vtype to set the
           * min/max allowed values (these are tested for after the vtype test)
           */
          return true;
        },

        password : function(val, field) {
          if (field.initialPassField) {
            var pwd = Ext.getCmp(field.initialPassField);
            return (val == pwd.getValue());
          }
          return true;
        },

        passwordText : 'Passwords do not match'
      });

      function logout(){
        Ext.Ajax.request({
          url : '/index/logout',
          success : function (result, request) {
            window.document.location.href = '/index/login';
          },
          failure : function (result, request){
            Ext.MessageBox.alert("提示","通讯失败，请从新操作");
          },
          method : 'GET'
        });        
      }
    </script>
  </head>
  <body>    
    <div id="toolbar"></div>
    <!--采购系统-->
    <ul id="purchase-actions" class="x-hidden">
      <li>
        <img src="/images/search.png" width=16  height=16/>
        <a id="purchase_order" href="#">采购订单</a>
      </li>
    </ul>
    <!--仓库系统-->
    <ul id="warehouse-actions" class="x-hidden">
      <li>
        <img src="/images/house.png" width=16  height=16/>
        <a id="opening_stock_list" href="#">期初库存</a>
      </li>
      <li>
        <img src="/images/house.png" width=16  height=16/>
        <a id="opening_stock_audit" href="#">期初审批</a>
      </li>
      <li>
        <img src="/images/house.png" width=16  height=16/>
        <a id="purchase_orders_for_warehousing" href="#">可入库采购订单</a>
      </li>
      <li>
        <img src="/images/house.png" width=16  height=16/>
        <a id="sale_orders_for_delivery" href="#">可出库销售订单</a>
      </li>
      <li>
        <img src="/images/user.png" width=16  height=16/>
        <a id="warehouse_entry" href="#">入库记录</a>
      </li>
      <li>
        <img src="/images/house.png" width=16  height=16/>
        <a id="delivery_order" href="#">出库记录</a>
      </li>
      <li>
        <img src="/images/house.png" width=16  height=16/>
        <a id="transfer_order" href="#">调拨记录</a>
      </li>
      <li>
        <img src="/images/house.png" width=16  height=16/>
        <a id="transfer_order_audit" href="#">调拨审批</a>
      </li>
      <li>
        <img src="/images/house.png" width=16  height=16/>
        <a id="separate_order" href="#">拆分记录</a>
      </li>
      <li>
        <img src="/images/house.png" width=16  height=16/>
        <a id="separate_order_audit" href="#">拆分审批</a>
      </li>
      <li>
        <img src="/images/house.png" width=16  height=16/>
        <a id="assembly_order" href="#">组合记录</a>
      </li>
      <li>
        <img src="/images/house.png" width=16  height=16/>
        <a id="assembly_order_audit" href="#">组合审批</a>
      </li>
      <li>
        <img src="/images/house.png" width=16  height=16/>
        <a id="stock_level" href="#">库存查询</a>
      </li>
    </ul>
    <!--销售系统-->
    <ul id="sales-actions" class="x-hidden">
      <li>
        <img src="/images/user.png" width=16  height=16/>
        <a id="sale_order" href="#">销售订单</a>
      </li>
    </ul>
    <ul id="finance-actions" class="x-hidden">
      <li>
        <img src="/images/user.png" width=16  height=16/>
        <a id="purchase_order_audit" href="#">采购订单审批</a>
      </li>
      <li>
        <img src="/images/user.png" width=16  height=16/>
        <a id="sale_order_audit" href="#">销售订单审批</a>
      </li>
      <li>
        <img src="/images/user.png" width=16  height=16/>
        <a id="sale_order_audit" href="#">退货订单审批</a>
      </li>
    </ul>
    <!--系统设置-->
    <ul id="system-setup" class="x-hidden">
      <li>
        <img src="/images/star.png" width=16  height=16/>
        <a id="warehouse_setup" href="#">仓库设置</a>
      </li>
      <li>
        <img src="/images/star.png" width=16  height=16/>
        <a id="product_setup" href="#">产品设置</a>
      </li>
      <li>
        <img src="/images/star.png" width=16  height=16/>
        <a id="customer_setup" href="#">客户设置</a>
      </li>
      <li>
        <img src="/images/star.png" width=16  height=16/>
        <a id="vendor_setup" href="#">供应商设置</a>
      </li>
      <li>
        <img src="/images/star.png" width=16  height=16/>
        <a id="role_setup" href="#">角色设置</a>
      </li>
      <li>
        <img src="/images/star.png" width=16  height=16/>
        <a id="department_setup" href="#">部门管理</a>
      </li>
      <li>
        <img src="/images/star.png" width=16  height=16/>
        <a id="employee_setup" href="#">用户管理</a>
      </li>
    </ul>
    <!--系统相关-->
    <ul id="system-service" class="x-hidden">
      <li>
        <img src="/images/star.png" width=16  height=16/>
        <a id="system_privilege" href="#">系统权限</a>
      </li>
      <li>
        <img src="/images/star.png" width=16  height=16/>
        <a id="system_log" href="#">系统日志</a>
      </li>
      <li>
        <img src="/images/star.png" width=16  height=16/>
        <a id="group-date" href="#">帮助</a>
      </li>
      <li>
        <img src="/images/star.png" width=16  height=16/>
        <a id="index_settlement" href="#">索引与结算</a>
      </li>
      <li>
        <img src="/images/stop.png" width=16  height=16/>
        <a id="group-cat" href="#" onclick="logout()">退出系统</a>
      </li>
    </ul>
    <%= javascript_include_tag "/javascripts/application.js" %>
  </body>
</html>
